package com.cdtu.outtake.domain;

import com.cdtu.outtake.domain.enums.OrderStatus;

import java.util.List;

import static com.cdtu.outtake.domain.enums.OrderStatus.*;

/**
 * @Author : shl
 * @Date 2024/4/11 1:23
 */
public enum OrderType {
    all, received, used, refund;

    public static OrderType from(OrderStatus status) {
        List<OrderStatus> statusListOfReceived = List.of(created, payed, consented, produced, delivering, delivered);
        if (statusListOfReceived.contains(status)) {
            return OrderType.received;
        }
        if (status == OrderStatus.received) {
            return OrderType.used;
        }
        return OrderType.refund;
    }
}
